package com.keyancompany.zhongbaopingtai.weight;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.keyancompany.zhongbaopingtai.R;
import com.keyancompany.zhongbaopingtai.api.TeamAPI;
import com.keyancompany.zhongbaopingtai.listener.IAsyncHttpResponseHandler;
import com.keyancompany.zhongbaopingtai.utils.ScreenUtils;

/**
 * Created by firefox on 2016/7/2.
 */
public class YaoQingMemberPopup extends MenuPopuWindow {

    private TextView sure, cancle;
    private EditText content;
    private TextView hint;

    public YaoQingMemberPopup(Context context) {
        super(context);
    }


    @Override
    public void setUpViews() {
        sure = (TextView) findViewById(R.id.sure);
        cancle = (TextView) findViewById(R.id.cancle);
        content = (EditText) findViewById(R.id.content);
        hint = (TextView) findViewById(R.id.hint);
        hint.setText("在这里@昵称，首先使用“@”符号+名字就会发出站内信成功邀请用户");
        content.setHint("请输入用户昵称");
        sure.setText("邀请");
    }

    @Override
    public void setUpListener() {

        sure.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                clickEvent();

            }
        });
        cancle.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                dismiss();
            }
        });
    }

    void clickEvent(){
        if(TextUtils.isEmpty(content.getText().toString())){
            return ;
        }
        if (cliclSureListener != null)
            cliclSureListener.clickSureLinstener(content.getText().toString());
    }

    @Override
    public int getAnimationStyle() {
        return 0;
    }

    @Override
    public int getResView() {
        return R.layout.pop_phont_code;
    }

    @Override
    public void updateView(View contentView) {
        setWidth(ScreenUtils.getScreenWidth(context) * 4 / 5);
    }
}
